﻿
// opencv_demo1.h: PROJECT_NAME 应用程序的主头文件
//

#pragma once

#include <opencv2\opencv.hpp>
#include <opencv2/highgui.hpp>
#include <opencv2/core.hpp>
#include <opencv2\imgproc\types_c.h>
#include <opencv2/imgcodecs.hpp>

using namespace cv;

#if 1

class watermask_cv_dct
{
public:
	watermask_cv_dct();

	int water_width = 64, water_height = 16;
	int m_blockLen = 8;  //图片分块长度
	double m_deep = 75.0;
	//int m_x = 2;  //水印嵌入位置
	//int m_y = 4;
	//int m_x2 = 3;  //水印嵌入位置
	//int m_y2 = 3;
	//从中间开始，往右上方走格子
	int m_x = m_blockLen / 2 - 1;  //水印嵌入位置
	int m_y = m_blockLen / 2;
	int m_x2 = m_blockLen - m_x;  //水印嵌入位置
	int m_y2 = m_blockLen - m_y;

	std::vector<int> m_watermask;

	void loadWatermask();
		
	Mat addImageWatermarkWithText(Mat image);
	Mat addImageWatermarkWithText(Mat image, std::vector<int> &watermark, int waterMarkLen, double p);
	Mat addImageWatermarY(Mat imageY);
	Mat addImageWatermarY(Mat imageY, std::vector<int>& watermark, int waterMarkLen, double p);
	Mat getImageWatermarkWithText(Mat image);

	std::vector<int> getInformationOfBinaryGraph(String srcPath); //获得水印文件的位图信息（0/1）
	void matrixToBinaryPhoto(std::vector<int>& watermark, String dstPath);  //没有使用

	Mat getBlock(Mat YMat, int index, int blockLen);
	void saveBlock(Mat YMat, Mat& blockMat,int index, int blockLen);

	static void myPrintCurTime(const char* pstr);
};

#endif